Skip to content

feat: use account API v4 transactions#29536

Merged
n3ps merged 24 commits into
mainfrom
n3ps/accounts-api-transactions
May 6, 2026
Merged

feat: use account API v4 transactions#29536
n3ps merged 24 commits into
mainfrom
n3ps/accounts-api-transactions

Conversation

@n3ps
Copy link
Copy Markdown
Contributor

@n3ps n3ps commented Apr 30, 2026

Description

  • Replaces confirmed EVM Activity transactions with data from accounts v4 API via React Query
  • Adds infinite pagination for confirmed EVM history
  • Keep local pending EVM transactions and existing non-EVM activity unchanged

Note: Due to the API requesting a bearer token, there is a current bottleneck in that token retrieval, in particular in AuthenticationController.getPrimaryEntropySourceId

Changelog

CHANGELOG entry: feat: use accounts API v4 for transactions

Related issues

Fixes:

Manual testing steps

Feature: Accounts API v4 Transactions

  Scenario: user views EVM activity
    Given the wallet has EVM confirmed on-chain activity

    When user visits the Activity tab
    Then confirmed onchain transactions returned by the Accounts v4 API is displayed on screen.

Screenshots/Recordings

Before

After

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Moderate risk because it rewires the Activity/UnifiedTransactionsView data source and filtering/deduping logic, which can change what transactions appear and when pagination/refresh occurs.

Overview
Confirmed EVM Activity now comes from the Accounts v4 API via a new React Query useTransactionsQuery hook, while local pending EVM transactions continue to come from controller state and are merged/deduped with the API results.

Adds a small transformation layer (helpers/adapters + helpers/transformations) to normalize API responses into TransactionMeta-compatible view models, filter out unwanted items (e.g. spam/incoming transfers/zero-value self-sends), and handle bridge-history matching/deduping (including case-insensitive hash matching).

Updates UnifiedTransactionsView to support infinite scrolling pagination (prefetch near the end of confirmed EVM items), show initial/next-page loading indicators, and refresh both local polling and the query. Related selector additions (selectLocalTransactions, selectRequiredTransactionHashes/Ids) support filtering required child txs and nonce/hash collisions, and tests/smoke mocks were updated accordingly.

Reviewed by Cursor Bugbot for commit a3e6592. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@n3ps n3ps added the team-core-extension-ux Core Extension UX team label Apr 30, 2026
@n3ps n3ps force-pushed the n3ps/accounts-api-transactions branch 8 times, most recently from 8b6d6b5 to 04b18d4 Compare April 30, 2026 04:42
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 12.42604% with 148 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.44%. Comparing base (4e11714) to head (04b18d4).

Files with missing lines Patch % Lines
...s/Views/UnifiedTransactionsView/helpers/mappers.ts 15.47% 71 Missing ⚠️
...nifiedTransactionsView/UnifiedTransactionsView.tsx 2.43% 40 Missing ⚠️
app/selectors/transactionController.ts 14.28% 12 Missing ⚠️
...ectors/multichainAccounts/accountTreeController.ts 15.38% 11 Missing ⚠️
...fiedTransactionsView/hooks/useTransactionsQuery.ts 12.50% 7 Missing ⚠️
app/core/apiClient.ts 14.28% 6 Missing ⚠️
app/selectors/networkEnablementController/index.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main   #29536       +/-   ##
===========================================
- Coverage   82.16%   44.44%   -37.73%     
===========================================
  Files        5176     5179        +3     
  Lines      137275   137376      +101     
  Branches    31024    31052       +28     
===========================================
- Hits       112795    61055    -51740     
- Misses      16840    70626    +53786     
+ Partials     7640     5695     -1945     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@n3ps n3ps force-pushed the n3ps/accounts-api-transactions branch 3 times, most recently from 9db07e8 to e7dcf8b Compare April 30, 2026 14:23
n3ps and others added 3 commits April 30, 2026 12:48
Co-authored-by: Francis Nepomuceno <n3ps@users.noreply.github.com>
Co-authored-by: Francis Nepomuceno <n3ps@users.noreply.github.com>
@n3ps n3ps force-pushed the n3ps/accounts-api-transactions branch 4 times, most recently from b8a00bb to d607d82 Compare April 30, 2026 17:32
pull Bot pushed a commit to Reality2byte/metamask-mobile that referenced this pull request Apr 30, 2026
<!-- CURSOR_AGENT_PR_BODY_BEGIN -->
## **Description**

Registers a mock empty Accounts API v4 transactions response for
testing.

Part of breaking down the Activity transactions PR into smaller chunks.

## **Changelog**

CHANGELOG entry: null

## **Related issues**

Refs: MetaMask#29536

## **Manual testing steps**

N/A - test infrastructure mock-only change.

## **Screenshots/Recordings**

N/A - no user-facing UI changes.

### **Before**

N/A

### **After**

N/A

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I've included tests if applicable
- [x] I've documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I've applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

#### Performance checks (if applicable)

- [x] I've tested on Android
  - N/A - mock-only change.
- [x] I've tested with a power user scenario
  - N/A - mock-only change.
- [x] I've instrumented key operations with Sentry traces for production
performance metrics
  - N/A - mock-only change.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
<!-- CURSOR_AGENT_PR_BODY_END -->

<div><a
href="https://cursor.com/agents/bc-f352c865-12ef-417e-b135-ece1f40ce868"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-web-light.png"><img
alt="Open in Web" width="114" height="28"
src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a
href="https://cursor.com/background-agent?bcId=bc-f352c865-12ef-417e-b135-ece1f40ce868"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img
alt="Open in Cursor" width="131" height="28"
src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div>

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
@n3ps n3ps force-pushed the n3ps/accounts-api-transactions branch 5 times, most recently from 2e28a13 to 86cda23 Compare May 1, 2026 00:53
@github-actions github-actions Bot removed the size-L label May 1, 2026
@n3ps n3ps requested a review from a team as a code owner May 5, 2026 16:17
@n3ps n3ps enabled auto-merge May 5, 2026 16:17
@n3ps n3ps force-pushed the n3ps/accounts-api-transactions branch from 09d69ea to d978b7b Compare May 5, 2026 16:26
Comment thread app/components/Views/UnifiedTransactionsView/helpers/adapters.ts
@n3ps n3ps force-pushed the n3ps/accounts-api-transactions branch from d978b7b to 3ef4b58 Compare May 5, 2026 17:18
vinnyhoward
vinnyhoward previously approved these changes May 5, 2026
Copy link
Copy Markdown
Contributor

@vinnyhoward vinnyhoward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very clean. LGTM!

Co-authored-by: Copilot <copilot@github.com>
vinnyhoward
vinnyhoward previously approved these changes May 5, 2026
Comment thread app/selectors/transactionController.ts
Co-authored-by: Copilot <copilot@github.com>
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d14b023. Configure here.

Comment thread app/components/Views/UnifiedTransactionsView/useTransactionsQuery.test.ts Outdated
@n3ps n3ps force-pushed the n3ps/accounts-api-transactions branch from d14b023 to 016149e Compare May 6, 2026 00:46
@n3ps n3ps force-pushed the n3ps/accounts-api-transactions branch from 016149e to 8b8ef87 Compare May 6, 2026 00:53
n3ps and others added 5 commits May 5, 2026 22:46
Co-authored-by: Francis Nepomuceno <n3ps@users.noreply.github.com>
Co-authored-by: Francis Nepomuceno <n3ps@users.noreply.github.com>
Co-authored-by: Francis Nepomuceno <n3ps@users.noreply.github.com>
@n3ps n3ps force-pushed the n3ps/accounts-api-transactions branch from ccddda7 to a3e6592 Compare May 6, 2026 19:24
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeWalletPlatform, SmokeSwap, SmokeStake, SmokeConfirmations, SmokeNetworkExpansion
  • Selected Performance tags: @PerformanceAssetLoading
  • Risk Level: high
  • AI Confidence: 82%
click to see 🤖 AI reasoning details

E2E Test Selection:

This PR introduces a major architectural change to the transaction history/activity view (UnifiedTransactionsView), switching from local Redux state to an API-based infinite query system using @tanstack/react-query and a new v4 accounts API endpoint.

Primary impact - SmokeWalletPlatform:

  • The incoming-transactions.spec.ts test is directly modified to use the new v4 API endpoint (/v4/multiaccount/transactions instead of v1). One test is skipped (privacyMode).
  • The UnifiedTransactionsView (transaction history/activity tab) is significantly refactored with pagination, infinite scroll, and new loading states.
  • The TransactionElement component has a race condition fix and new pending state rendering.
  • Badge positioning changes in MultichainTransactionListItem and MultichainBridgeTransactionListItem.
  • New apiClient.ts using AuthenticationController bearer token.
  • New selectors in transactionController.ts for local transaction management.

SmokeSwap selected because:

  • Bridge transaction history display is affected (useBridgeTxHistoryData.ts changes for hash-based fallback matching)
  • The MultichainBridgeTransactionListItem badge changes affect bridge transaction display
  • Swap/bridge activity appears in the transaction history view that was refactored
  • Per tag description: "also select SmokeConfirmations" when selecting SmokeSwap

SmokeStake selected because:

  • Stake transactions appear in the activity/transaction history view that was refactored
  • Per tag description: "also select SmokeConfirmations" when selecting SmokeStake

SmokeConfirmations selected because:

  • Required as dependent tag when SmokeSwap and SmokeStake are selected
  • Transaction confirmations feed into the transaction history view

SmokeNetworkExpansion selected because:

  • Non-EVM (Solana, Bitcoin) transactions are part of the UnifiedTransactionsView merge logic (mergeTransactionsByTime)
  • The MultichainTransactionListItem badge changes affect non-EVM transaction display
  • The TransactionKind.NonEvm path in the refactored view handles Solana/Bitcoin transactions

The changes do NOT directly affect: account management (SmokeAccounts), identity/sync (SmokeIdentity), network management UI (SmokeNetworkAbstractions), browser (SmokeBrowser), Snaps (SmokeSnaps), card/ramps (SmokeMoney), perps (SmokePerps), predictions (SmokePredictions), multi-chain API sessions (SmokeMultiChainAPI), or seedless onboarding (SmokeSeedlessOnboarding).

Performance Test Selection:
The UnifiedTransactionsView has been significantly refactored to use API-based infinite pagination instead of local Redux state. This introduces network requests, @tanstack/react-query infinite queries, and new loading states that could impact the performance of the activity/transaction history tab. The @PerformanceAssetLoading tag covers token list rendering and balance/portfolio loading which is closely related to the transaction history display. The pagination and infinite scroll implementation could affect rendering performance when loading large transaction histories.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 6, 2026

@n3ps n3ps requested a review from vinnyhoward May 6, 2026 20:24
@n3ps n3ps added this pull request to the merge queue May 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.77.0 Issue or pull request that will be included in release 7.77.0 size-XL team-core-extension-ux Core Extension UX team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants